package com.poorstu.web.studentApply;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.common.base.web.BaseAction;
import com.poorstu.manager.LoadManager;

public class LoadAddAction extends BaseAction {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		try{
			DynaActionForm dyna=(DynaActionForm)form;
			int flowId=1;//贷款为1  助学为2 平困为3
			int allUserId=(Integer)request.getSession().getAttribute("allUserId");
			int moneyId=(Integer)dyna.get("loadAmount");
			String loadReason=(String)dyna.get("loadReason");
			LoadManager loadManager=(LoadManager)getBean("loadManager");
			loadManager.saveLoad(allUserId, flowId, moneyId, loadReason);
			return mapping.findForward("succ");
		}
		catch(Exception e){
			e.printStackTrace();
			return mapping.findForward("failure");
		}
	}
	

}
